<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8" isELIgnored="false"%>
<%@ include file="/WEB-INF/views/shared/taglib.jsp"%>
<%
	request.setAttribute("title", "个人资料");
%>
<%@ include file="/WEB-INF/views/shared/master/weContentHeader.jsp"%>
<style type="text/css">
body{
	background-color: #f5f5f5;
}
	.title {
		z-index: 0 !important;
	}
	.text-right{
		text-align: right;
	}
	.label-color{
		color:#999 !important;
	}
	.chevron-right-color{
		color: #999;
	}
	.msginput{
		border:none;
		height:30px;
		font-size: 16px;
		width: auto;
		text-align: right;
		color: #999;
	}
	
	.color-red{
		color:red !important;
	}
	.color-wait{
	 color:#ea693f !important;
	}
	.weui-cell{
		padding: 15px;
	}
</style>
<%@ include file="/WEB-INF/views/shared/master/weTitle.jsp"%>
<div class="goback" data-back-point="personCenter"></div>
<input type="hidden" value="${customer.username}" class="username"/>
<input type="hidden" value="${isMaker}" class="isMaker"/>
<input type="hidden" value="${customer.level}" class="level"/>
<input type="hidden" value="${customer.autonym}" class="autonym"/>
<input type="hidden" value="${month}" class="month"/>
	<div class="weui-cells">

	  <div class="weui-cell" style="padding: 3px 15px;">
	    <div class="weui-cell__bd">
	      <p>头像</p>
	    </div>
	    <div class="weui-cell__ft label-color"> 
	    	<%-- <img style="width:72px;height:72px;border-radius:50%;margin-top: 0.2rem" src="<c:url value='/images/we/personCenter/touxiang.png' />" /> --%> 
	    	<img style="width:72px;height:72px;border-radius:50%;margin-top: 0.2rem" src="${loginModel.headImgUrl}" />
	    </div>
	  </div>
	  <div class="weui-cell weui-cell_access">
	    <div class="weui-cell__bd">
	      <p>昵称</p>
	    </div>
	    <div class="weui-cell__ft label-color">  
	    	<input class="msginput nameinput" name="nickname" value="${loginModel.nickName}"/>
	    </div>
	  </div>
	  <div class="weui-cell">
	    <div class="weui-cell__bd">
	      <p>性别</p>
	    </div>
	    <div class="weui-cell__ft label-color">
	    	<t:provider packageName="default" enumClassName="SexStatus" value="${customer.sex}"/>   
	    </div>
	  </div>
	  <div class="weui-cell weui-cell_access">
	    <div class="weui-cell__bd">
	      <p>出生日期</p>
	    </div>
	    <div class="weui-cell__ft label-color">
	    	<input class="msginput dateinput" name="birthday" type="text" data-toggle='date'  value="<fmt:formatDate value="${customer.birthday}" pattern="yyyy/MM/dd"/>"/> 
		    </div>
	  </div>
	  
	  <div style="height: 13px;background-color: #f5f5f5;"></div>
	  
	  <div class="weui-cell">
	    <div class="weui-cell__bd">
	      <p>会员编号</p>
	    </div>
	    <div class="weui-cell__ft label-color">${customer.userIdentity}</div>
	  </div>
	  <div class="weui-cell">
	    <div class="weui-cell__bd">
	      <p>手机号码</p>
	    </div>
	    <div class="weui-cell__ft label-color">${customer.phone}</div>
	  </div>
	  <%-- <div class="weui-cell weui-cell_access" onclick="checkAutonym()">
	    <div class="weui-cell__bd">
	      <p>实名认证</p>
	    </div>
	    <div class="weui-cell__ft label-color">
	    	<c:if test="${customer.autonym==0}">
	    		<span>${customer.username}</span>
	    	</c:if>
	    	<c:if test="${customer.autonym==1}">
	    		<span style="color: red">未认证</span>
	    	</c:if>
	    </div>
	  </div> --%>
	  <div class="weui-cell weui-cell_access">
	    <div class="weui-cell__bd">
	      <p>邮箱</p>
	    </div>
	    <div class="weui-cell__ft label-color">
	    	<input type="email"  class="msginput emailinput" name="email" value="${customer.email}" onblur="ckecked_email()"/>
	    </div>
	  </div>
	  <div class="weui-cell weui-cell_access cannotChange">
	    <div class="weui-cell__bd">
	      <p>服务地区</p>
	    </div>
	    <c:if test="${isMaker=='noMaker'}">
	    	 <div class="weui-cell__ft label-color">${customer.region}</div>	    
	    </c:if>
	    <c:if test="${isMaker=='yesMaker'}">
		    <div class="weui-cell__ft label-color">    	 	
		    	<input id="city-picker" class="msginput" name="region" value="${customer.region}"/>	    	 	
		    </div>
	    </c:if>
	  </div>
	</div>

<%@ include file="/WEB-INF/views/shared/scripts/jquery.jsp"%>
<%@ include file="/WEB-INF/views/shared/scripts/jqweui.jsp"%>
<%@ include file="/WEB-INF/views/shared/scripts/city-picker.jsp"%>

<script type="text/javascript">

	var url =$.getVirtualPath()+'/wechat/cust/personCenter/personDetailed';

	$(function(){
		loadCity();
		loadBirthday();
	});
	
	//判断实名认证状态
	$(function () {
		
		//地区修改提示
		$(".cannotChange").click(function () {
			if($(".isMaker").val()=='noMaker'){
				var month = $(".month").val();
				$.alert("服务地区的修改期限为"+month+"个月，您不在修改期限内","温馨提示：");
			}else if ($(".isMaker").val()=='notMaker') {
				$.alert("只有创客才能修改服务地区", "温馨提示：");
			}
			else{
				$.toast("只能修改一次，请慎重选择", "forbidden");
			}
		})		
	})
	
	function loadBirthday(){
		$(".dateinput").calendar({
			dateFormat:'yyyy/mm/dd',
			onClose:function(){
				$.post(url,{birthday:$(".dateinput").val()},function(){ });
			}
		});
	}
	
	function loadCity(){	 	
		$("#city-picker").cityPicker({		 	
			title: "请选择服务地区",		 	
			onClose:function(){		 	
			$.post(url,{region:$("#city-picker").val()},function(){
				$(".isMaker").val("noMaker");
			});		 	
			}						 	
		});		 	
	}
	
	$(".nameinput").change(function () {
		$.post(url,{nickname:$(".nameinput").val()},function(){});
	});
	
	function ckecked_email() {
	    var reg=new RegExp("^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((.[a-zA-Z0-9_-]{2,3}){1,2})$");
	    var name=$(".emailinput").val();
	    if( !reg.test(name)) {
	    	$(".emailinput").val("");
	        $(".emailinput").attr("placeholder","请正确填写email");
	    }else {
	    	$.post(url,{email:$(".emailinput").val()},function(){});
	    }
	}
	
	/* function checkAutonym() {
		if($(".autonym").val()=="0"){
			$.toast("已认证","text");
		}else{
			var url = $.getVirtualPath()+"/wechat/cust/personCenter/realName";
			window.location.href =url; 
		}
	} */
</script>


<%@ include file="/WEB-INF/views/shared/master/weContentFooter.jsp"%>
